﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BalanceControl.Comm
{
    public class ScopeFrame
    {
        private const byte PROTOCOL_HEADER = 0x55;
        private const byte PROTOCOL_COMMAND_BLANK = 0x00;
        private const byte PROTOCOL_COMMAND_REPORT = 0x01;
        private const byte PROTOCOL_COMMAND_WRITE = 0x02;

        private byte[] buffer;

        public ScopeFrame(byte cmd, byte ch, float value)
        {
            buffer = new byte[7];
            buffer[0] = 0x55;
            buffer[1] = cmd;
            buffer[2] = ch;
            byte[] value_bytes = BitConverter.GetBytes(value);
            Buffer.BlockCopy(value_bytes, 0, buffer, 3, value_bytes.Count());
        }


        public byte[] GetBytes()
        {
            return buffer;
        }
    }
}
